<?php

namespace App\Observers;

use App\Models\ProductsBatchModel;
use App\Models\ProductsSaleModel;

class ProductsBatchObserver
{
    /**
     * Handle the products Batch model "created" event.
     *
     * @param \App\ProductsBatchModel $productsBatchModel
     * @return void
     */
    public function creating(ProductsBatchModel $productsBatchModel)
    {
        $productsBatchModel->setAttribute('source_code', ProductsSaleModel::createSourceCode());
    }

    /**
     * Handle the products Batch model "updated" event.
     *
     * @param \App\ProductsBatchModel $productsBatchModel
     * @return void
     */
    public function updated(ProductsBatchModel $productsBatchModel)
    {
    }

    /**
     * Handle the products Batch model "deleted" event.
     *
     * @param \App\ProductsBatchModel $productsBatchModel
     * @return void
     */
    public function deleted(ProductsBatchModel $productsBatchModel)
    {
        //
    }

    /**
     * Handle the products Batch model "restored" event.
     *
     * @param \App\ProductsBatchModel $productsBatchModel
     * @return void
     */
    public function restored(ProductsBatchModel $productsBatchModel)
    {
        //
    }

    /**
     * Handle the products Batch model "force deleted" event.
     *
     * @param \App\ProductsBatchModel $productsBatchModel
     * @return void
     */
    public function forceDeleted(ProductsBatchModel $productsBatchModel)
    {
        //
    }
}
